<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="NAME">KISSY.add</span><span class="PUNC">(</span><span class="STRN">"gallery/grid/1.0/loadMask"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">S</span><span class="PUNC">,</span><span class="NAME">util</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>  2</span> 
<span class='line'>  3</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>  4</span> 	* 屏蔽指定元素，并显示加载信息
<span class='line'>  5</span> 	* @memberOf Grid
<span class='line'>  6</span> 	* @name LoadMask
<span class='line'>  7</span> 	* @class 加载屏蔽类
<span class='line'>  8</span> 	* @property {String|DOM|Node} el 要屏蔽的元素，选择器、Dom元素或Node元素
<span class='line'>  9</span> 	* @param {String|DOM|Node} element 要屏蔽的元素，选择器、Dom元素或Node元素
<span class='line'> 10</span> 	* @param {Object} config 配置信息&lt;br>
<span class='line'> 11</span> 	* 1) msg :加载时显示的加载信息&lt;br>
<span class='line'> 12</span> 	* 2) msgCls : 加载时显示信息的样式
<span class='line'> 13</span> 	*/</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">LoadMask</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">        </span><span class="NAME">_self.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">		</span><span class="NAME">LoadMask.superclass.constructor.call</span><span class="PUNC">(</span><span class="NAME">_self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">		</span><span class="NAME">_self._init</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 21</span> 
<span class='line'> 22</span> </span><span class="WHIT">	</span><span class="NAME">S.extend</span><span class="PUNC">(</span><span class="NAME">LoadMask</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">S.Base</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">    </span><span class="COMM">//对象原型</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">    </span><span class="NAME">S.augment</span><span class="PUNC">(</span><span class="NAME">LoadMask</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">	</span><span class="COMM">/** @lends Grid.LoadMask.prototype */</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 28</span> 		* 加载时显示的加载信息
<span class='line'> 29</span> 		* @field 
<span class='line'> 30</span> 		* @default Loading...
<span class='line'> 31</span> 		*/</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">        </span><span class="NAME">msg</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'Loading...'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 34</span> 		* 加载时显示的加载信息的样式
<span class='line'> 35</span> 		* @field
<span class='line'> 36</span> 		* @default x-mask-loading
<span class='line'> 37</span> 		*/</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">        </span><span class="NAME">msgCls</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'x-mask-loading'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 40</span> 		* 加载控件是否禁用
<span class='line'> 41</span> 		* @type Boolean
<span class='line'> 42</span> 		* @field
<span class='line'> 43</span> 		* @default false
<span class='line'> 44</span> 		*/</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">        </span><span class="NAME">disabled</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">		</span><span class="NAME">_init</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">			</span><span class="NAME">_self.msg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_self.get</span><span class="PUNC">(</span><span class="STRN">'msg'</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">_self.msg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 51</span> 		* @description 设置控件不可用
<span class='line'> 52</span> 		*/</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">        </span><span class="NAME">disable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">            </span><span class="NAME">this.disabled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 57</span> 		* @private 设置控件可用
<span class='line'> 58</span> 		*/</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">        </span><span class="NAME">enable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">            </span><span class="NAME">this.disabled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 62</span> 
<span class='line'> 63</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 64</span> 		* @private 加载已经完毕，解除屏蔽
<span class='line'> 65</span> 		*/</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">        </span><span class="NAME">onLoad</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">            </span><span class="NAME">util.unmaskElement</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 69</span> 
<span class='line'> 70</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 71</span> 		* @private 开始加载，屏蔽当前元素
<span class='line'> 72</span> 		*/</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">        </span><span class="NAME">onBeforeLoad</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.disabled</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">                </span><span class="NAME">util.maskElement</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.msg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.msgCls</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> 
<span class='line'> 77</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 80</span>         * 显示加载条，并遮盖元素
<span class='line'> 81</span>         */</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">        </span><span class="NAME">show</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">            </span><span class="NAME">this.onBeforeLoad</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 85</span> 
<span class='line'> 86</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 87</span>         * 隐藏加载条，并解除遮盖元素
<span class='line'> 88</span>         */</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">        </span><span class="NAME">hide</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">            </span><span class="NAME">this.onLoad</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 92</span> 
<span class='line'> 93</span> </span><span class="WHIT">        </span><span class="COMM">/*
<span class='line'> 94</span> 		* 清理资源
<span class='line'> 95</span> 		*/</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">        </span><span class="NAME">destroy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">			</span><span class="NAME">this.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>100</span> 
<span class='line'>101</span> </span><span class="WHIT">	</span><span class="COMM">//S.LP.LoadMask = LoadMask;</span><span class="WHIT">
<span class='line'>102</span> 
<span class='line'>103</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">LoadMask</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>104</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">requires</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"./util"</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>